/// @tags: SegmentTree
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int constexpr N = 2e5 + 5, SEGN = N * 4, P = 998244353;

/// 2^i
int k = 1;
int n, m;
int f[SEGN], g[SEGN], tagF[SEGN], tagG[SEGN], sumf[SEGN];

inline int inc(int x, int y) {
  x += y;
  return x >= P ? x - P : x;
}

inline int dec(int x, int y) {
  x -= y;
  return x < 0 ? x + P : x;
}

inline void pushUp(int x) { sumf[x] = inc(f[x], inc(sumf[x << 1], sumf[x << 1 | 1])); }

inline void pushTagF(int x, int val) {
  f[x] = (LL)f[x] * val % P;
  tagF[x] = (LL)tagF[x] * val % P;
  sumf[x] = (LL)sumf[x] * val % P;
}

inline void pushTagG(int x, int val) {
  g[x] = (LL)g[x] * val % P;
  tagG[x] = (LL)tagG[x] * val % P;
}

inline void pushDown(int x) {
  if (tagF[x] != 1) {
    pushTagF(x << 1, tagF[x]);
    pushTagF(x << 1 | 1, tagF[x]);
    tagF[x] = 1;
  }
  if (tagG[x] != 1) {
    pushTagG(x << 1, tagG[x]);
    pushTagG(x << 1 | 1, tagG[x]);
    tagG[x] = 1;
  }
}

void build(int x, int l, int r) {
  g[x] = tagF[x] = tagG[x] = 1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
}

void modify(int x, int l, int r, int L, int R) {
  pushDown(x);
  if (L <= l && r <= R) {
    f[x] = inc(f[x], k);
    pushTagF(x << 1, 2);
    pushTagF(x << 1 | 1, 2);
    return pushUp(x);
  }
  int mid = (l + r) >> 1, ls = x << 1, rs = x << 1 | 1;
  g[x] = inc(g[x], k);
  if (R <= mid) {
    modify(ls, l, mid, L, R);
    pushDown(rs);
    f[rs] = inc(f[rs], dec(k, g[rs]));
    g[rs] = inc(g[rs], g[rs]);
    pushTagF(rs << 1, 2);
    pushTagF(rs << 1 | 1, 2);
    pushTagG(rs << 1, 2);
    pushTagG(rs << 1 | 1, 2);
    pushUp(rs);
  } else if (L > mid) {
    modify(rs, mid + 1, r, L, R);
    pushDown(ls);
    f[ls] = inc(f[ls], dec(k, g[ls]));
    g[ls] = inc(g[ls], g[ls]);
    pushTagF(ls << 1, 2);
    pushTagF(ls << 1 | 1, 2);
    pushTagG(ls << 1, 2);
    pushTagG(ls << 1 | 1, 2);
    pushUp(ls);
  } else {
    modify(ls, l, mid, L, mid);
    modify(rs, mid + 1, r, mid + 1, R);
  }
  pushUp(x);
}

inline int main() {
  cin >> n >> m;
  build(1, 1, n);
  for (int opt, l, r; m; --m) {
    cin >> opt;
    if (opt == 1) {
      cin >> l >> r;
      modify(1, 1, n, l, r);
      k = inc(k, k);
    } else {
      cout << sumf[1] << '\n';
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P5280 [ZJOI2019] 线段树.in", "r", stdin);
  freopen("P5280 [ZJOI2019] 线段树.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
